// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
//
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.commons.connectivity;

/**
 * Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf 1 2006-09-29 17:06:40Z qiang.zhang $
 * 
 */
public enum ESubDatabaseType {
    SYBASE_IQ(EDatabaseType.SYBASE, "Sybase IQ", "jdbc:sybase:Tds:<host>:<port>/<sid>", "2638", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    SYBASE_ASE(EDatabaseType.SYBASE, "Sybase ASE", "jdbc:sybase:Tds:<host>:<port>/<sid>", "5001", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    DERBY_CLIENT(EDatabaseType.DERBY, "Derby Client", "jdbc:derby://<host>:<port>/<sid>", "1527", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    DERBY_EMBEDDED(EDatabaseType.DERBY, "Derby Embedded", "jdbc:derby:<rootPath>", "0", Boolean.FALSE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    DERBY_JCC(EDatabaseType.DERBY, "DB2 Universal (JCC)", "jdbc:derby:net://<host>:<port>/<sid>", "1527", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    HSQLDB_SERVER(EDatabaseType.HSQLDB, "Hsqldb Server", "jdbc:hsqldb:hsql://<host>:<port>/<sid>", "9001", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    HSQLDB_WEBSERVER(EDatabaseType.HSQLDB, "Hsqldb Web Server", "jdbc:hsqldb:http://<host>:<port>/<sid>", "9001", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    HSQLDB_INPROCESS(EDatabaseType.HSQLDB, "Hsqldb In-Process (Standalone)", //$NON-NLS-1$
                     "jdbc:hsqldb:file:<rootPath>/<sid>;ifexists=true", //$NON-NLS-1$
                     "0", //$NON-NLS-1$
                     Boolean.FALSE),
    HSQLDB_SERVLET(EDatabaseType.HSQLDB, "Hsqldb Servlet", "jdbc:hsqldb:hsql://<host>/<sid>", "0", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    ORACLE_SERNAME(EDatabaseType.ORACLE, "Oracle Service Name", //$NON-NLS-1$
                   "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=<host>)(port=<port>))(connect_data=(service_name=<service_name>)))", //$NON-NLS-1$
                   "1521", //$NON-NLS-1$
                   Boolean.TRUE),
    ORACLE_SID(EDatabaseType.ORACLE, "Oracle SID", "jdbc:oracle:thin:@<host>:<port>:<sid>", "1521", Boolean.TRUE), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    ORACLE_OCI(EDatabaseType.ORACLE, "Oracle Oci", "jdbc:oracle:oci:@<host>:<port>:<sid>", "1521", Boolean.TRUE); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    private EDatabaseType type;

    private String subName;

    private String url;

    private String port;

    private Boolean isNeedUser;

    /**
     * Qiang.Zhang.Adolf@gmail.com ESubDatabaseType constructor comment.
     * 
     * @param type
     * @param subName
     */

    ESubDatabaseType(EDatabaseType type, String subName, String url, String port, Boolean isNeedUser) {
        this.type = type;
        this.subName = subName;
        this.url = url;
        this.port = port;
        this.isNeedUser = isNeedUser;
    }

    /**
     * Qiang.Zhang.Adolf@gmail.com Comment method "getType".
     * 
     * @return
     */
    public EDatabaseType getType() {
        return this.type;
    }

    /**
     * Qiang.Zhang.Adolf@gmail.com Comment method "getSubName".
     * 
     * @return
     */
    public String getSubName() {
        return this.subName;
    }

    /**
     * Qiang.Zhang.Adolf@gmail.com Comment method "getUrl".
     * 
     * @return
     */
    public String getUrl() {
        return this.url;
    }

    /**
     * Qiang.Zhang.Adolf@gmail.com Comment method "getPort".
     * 
     * @return
     */
    public String getPort() {
        return this.port;
    }

    /**
     * Qiang.Zhang.Adolf@gmail.com Comment method "getDriver".
     * 
     * @return
     */
    public String getDriver() {
        switch (this) {
        case DERBY_CLIENT:
            return "org.apache.derby.jdbc.ClientDriver"; //$NON-NLS-1$
        case DERBY_EMBEDDED:
            return "org.apache.derby.jdbc.EmbeddedDriver"; //$NON-NLS-1$
        case DERBY_JCC:
            return "com.ibm.db2.jcc.DB2Driver"; //$NON-NLS-1$
        default:
            return getType().getDriver();
        }
    }

    /**
     * Getter for isNeedUser.
     * 
     * @return the isNeedUser
     */
    public Boolean isNeedUser() {
        return this.isNeedUser;
    }
}
